<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="jquery.min.js"></script>

<script type="text/javascript" src="ddaccordion.js"></script>
<script type="text/javascript">

//Initialize Arrow Side Menu:
ddaccordion.init({
	headerclass: "menuheaders", //Shared CSS class name of headers group
	contentclass: "menucontents", //Shared CSS class name of contents group
	revealtype: "clickgo", //Reveal content when user clicks or onmouseover the header? Valid value: "click", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["unselected", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: 500, //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

</script>

<style type="text/css">

.arrowsidemenu{
	width: 780px; /*width of menu*/
	border-style: solid solid none solid;
	border-color: #94AA74;
	border-size: 1px;
	border-width: 1px;
}
 div.pub{
	background: transparent url(images/gs4.fw.png) 100% 0;
	height:40px;
	width:780px;
	text-align:left;
	vertical-align:central;
	font-weight:bold;
	color:#036;
}
div.pub:hover{
	background: transparent url(images/gs42.fw.png) 100% 0;
	height:40px;
	width:780px;
	text-align:left;
	vertical-align:central;
}
	
.arrowsidemenu div a{ /*header bar links*/
	font: bold 12px Verdana, Arial, Helvetica, sans-serif;
	display: block;
	background: transparent url(images/arrowgreen.gif) 100% 0;
  height: 24px; /*Set to height of bg image-padding within link (ie: 32px - 4px - 4px)*/
	padding: 4px 0 4px 10px;
	line-height: 24px; /*Set line-height of bg image-padding within link (ie: 32px - 4px - 4px)*/
	text-decoration: none;
}
	
.arrowsidemenu div a:link, .arrowsidemenu div a:visited{
	color: #26370A;
}

.arrowsidemenu div a:hover{
	background-position: 100% -32px;
}

.arrowsidemenu div.unselected a{ /*header that's currently not selected*/
	color: #6F3700;
}

	
.arrowsidemenu div.selected a{ /*header that's currently selected*/
	color: blue;
	background-position: 100% -64px !important;
}

.arrowsidemenu ul{
	list-style-type: none;
	margin: 0;
	padding: 0;
}

.arrowsidemenu ul li{
	border-bottom: 1px solid #a1c67b;
}


.arrowsidemenu ul li a{ /*sub menu links*/
	display: block;
	font: normal 12px Verdana, Arial, Helvetica, sans-serif;
	text-decoration: none;
	color: black;
	padding: 5px 0;
	padding-left: 10px;
	border-left: 10px double #a1c67b;
}

.arrowsidemenu ul li a:hover{
	background: #d5e5c1;
}

</style>
<style type=text/css>
body {
	background-color: #F5F5F5;
}
table {
	align: center;
	width:100%;
	
}
table.imagetable {

	font-family: verdana,arial,sans-serif;
	font-size:14px;
	color:#333333;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
}
table.imagetable th {
	background:#b5cfd2 url(cell-blue.jpg);
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
table.imagetable td {
	background:#dcddc0 url(cell-grey.jpg);
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
</style>
</head>

<body><div style="position: absolute; left: 560px; top: 60px;">
<?php
$curr_month = date("m");
$month = array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$dis="
<style type=text/css>
form.s4find {
background: -webkit-gradient(linear, bottom, left 175px, from(#CCCCCC), to(#EEEEEE));
background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
margin:auto;
position:absolute;
right:-200px;
width:390px;
height:30px;
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-style: italic;
line-height: 24px;
font-weight: bold;
color: #000;
text-decoration: none;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding:10px;
border: 1px solid #999;
border: inset 1px solid #333;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);		
}
input.submit2 {
	width: 100px;
	background: #666;
	color: #fff;
	font-family: Tahoma, Geneva, sans-serif;
	height: 30px;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	border: 1p solid #999;
	background-color: #666;
}
</style>
<form class=s4find method=post action=gs4rep.php><table align=center><tr>
<td><select name=mnth>";
$k=1;
$q=$curr_month-1;
if($q<1){
	$q=12;
}
for($i=0; $i<12; $i++){
	if($k==$q){
		$dis.="<option value=$k selected=selected>$month[$i]</option>";
		$k++;
	}else{
	$dis.="<option value=$k>$month[$i]</option>";
		$k++;	
	}
}

$dis.="</select></td><td><select name=yr>";
$curr_yr=date("Y");
for($j=2010; $j<2099; $j++){
if($j==$curr_yr){
$dis.="<option value=$j selected=selected>$j</option>";	
}else{
$dis.="<option value=$j>$j</option>";	
}
}
$dis.="</select></td><td><select name=grp>
<option selected=selected required=require>Select Group</option>
";
for($i=1; $i<16; $i++){
	$dis.="<option value=$i>$i</option>";
}
$dis.="</select></td><td><input type=submit name=finds4 value=Search id=finds4 class=submit2 /></td>
</tr></table></form>";
print("$dis");

?></div>
<div style="position: absolute; left: 120px; top: 126px;">
<?php
include("conn.php");
$res="<div class=arrowsidemenu>";
//put code to display all publisher	
if (isset($_POST['grp'])){
	$m=$_POST['mnth'];
	$y=$_POST['yr'];
	$lm=$m-1;
	if($m<1){
		$m=12;
		$ly=$y-1;
	}else{
		$ly=$y;
	}
	$sd=$ly."-".$lm."-21";
	$sd1=strtotime($sd);
	$sdate=date('Y-m-d',$sd1);
	$em=date("m");
	$ey=date("Y");
	$ed=$ey."-".$em."-20";
	$ed1=strtotime($ed);
	$edate=date('Y-m-d',$ed1);
	$c=$_POST['grp'];
	print("<h2 align=center>Group $c Field Service Report For Submissions Done Between: $sdate and $edate</h2>");
//print("<font color=red><strong>**Please select Group Number From Drop Down Menu Above. Do not forget to specify the required month and year</strong></font>");	
$s="select * from publishers where pubgrpnum='$c' and state=1 order by lname, fname asc";
$r=mysql_query($s, $conn) or die(mysql_error());
if(mysql_num_rows($r)>0){
	while($t=mysql_fetch_array($r)){
		$id=$t['pubid'];
		$ln=$t['lname'];
		$fn=$t['fname'];
		$q="select * from s4 where pubid='$id' and indate between '$sdate' and '$edate'";
		$res.="<div class=menuheaders><div align=left class=pub>Field Service Report For $fn $ln</div></div>
	<ul class=menucontents>
		<li><table class=imagetable><tr>
		<th align=left>Period</th>
		<th align=center>Books</th>
		<th align=center>Booklets</th>
		<th align=center>Hours</th>
		<th align=center>Magazines</th>
		<th align=center>Return Visits</th>
		<th align=center>Bible Study</th>
		</tr>";
		$rr=mysql_query($q,$conn) or die(mysql_error());
		if(mysql_num_rows($rr)>0){
		while($tt=mysql_fetch_array($rr)){
			$cm=$tt['Month'];
			$cm--;
			 $res.="<tr>
			 <td>$month[$cm] $tt[yr]</td>
			 <td align=center>$tt[bks]</td>
			 <td align=center>$tt[bklets]</td>
			 <td align=center>$tt[hrs]</td>
			 <td align=center>$tt[magz]</td>
			 <td align=center>$tt[rvisits]</td>
			 <td align=center>$tt[bstudy]</td>
			 </tr>";
		}
		}
		$res.="</table></li></ul>";
	}
	$res.="</div>";
	print("$res");
}
}
?>
</div>
</body>
</html>